﻿using System;
using System.Diagnostics.Contracts;
using System.Windows.Input;

namespace OpenLS.Spreadsheet.UI
{
    class DelegatingCommand: ICommand
    {
        public DelegatingCommand(Action<object> action)
        {
            Contract.Requires(action != null);
            _action = action;
        }

        private Action<object> _action;
        public void Execute(object parameter)
        {
            _action(parameter);
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}